class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: F = None
        self.r: G = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: F = None
        self.r: G = None
        self.q: C = None
        self.u: E = None
        self.t: C = None
        self.s: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

a = A("a")
h = B("h")
k = C("k")
f = D("f")
c = E("c")
j = F("j")
b = G("b")
g = E("g")

a.s = k
a.q = j
a.r = b
a.t = h
h.w = b
h.y = k
k.q = a
f.w = k
f.q = k
f.t = k
f.x = j
f.s = j
f.r = b
f.u = c
c.u = h
c.t = a
j.u = f
j.w = k
b.p = k
g.u = h
g.t = a
assert c.u.y.q.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: F = None
        self.r: G = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: F = None
        self.r: G = None
        self.q: C = None
        self.u: E = None
        self.t: C = None
        self.s: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

a = A("a")
h = B("h")
k = C("k")
f = D("f")
c = E("c")
j = F("j")
b = G("b")
g = E("g")

a.s = k
a.q = j
a.r = b
a.t = h
h.w = b
h.y = k
k.q = a
f.w = k
f.q = k
f.t = k
f.x = j
f.s = j
f.r = b
f.u = c
c.u = h
c.t = a
j.u = f
j.w = k
b.p = k
g.u = h
g.t = a
assert c.u.y.q.r.p.txt == "k"