class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: B = None
        self.r: B = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: E = None
        self.p: A = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

i.q = f
i.x = b
i.r = b
i.z = a
b.z = g
b.s = c
b.p = a
b.x = k
g.v = b
g.q = j
f.r = i
f.x = g
f.v = a
m.y = f
m.s = i
j.t = f
c.y = f
c.s = i
a.q = f
a.x = b
a.r = b
a.z = i
k.y = f
k.s = a
assert j.t.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: B = None
        self.r: B = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: E = None
        self.p: A = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

i.q = f
i.x = b
i.r = b
i.z = a
b.z = g
b.s = c
b.p = a
b.x = k
g.v = b
g.q = j
f.r = i
f.x = g
f.v = a
m.y = f
m.s = i
j.t = f
c.y = f
c.s = i
a.q = f
a.x = b
a.r = b
a.z = i
k.y = f
k.s = a
assert j.t.x.v.txt == "b"