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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: F = None
        self.x: E = None
        self.t: A = None
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

j = A("j")
e = B("e")
f = C("f")
b = D("b")
i = E("i")
g = F("g")

j.t = f
j.v = g
j.r = g
e.v = f
e.y = g
e.x = i
e.t = j
e.p = b
f.w = j
f.q = b
f.t = i
b.z = g
b.s = j
i.q = g
g.q = i
assert e.v.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: F = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: F = None
        self.x: E = None
        self.t: A = None
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

j = A("j")
e = B("e")
f = C("f")
b = D("b")
i = E("i")
g = F("g")

j.t = f
j.v = g
j.r = g
e.v = f
e.y = g
e.x = i
e.t = j
e.p = b
f.w = j
f.q = b
f.t = i
b.z = g
b.s = j
i.q = g
g.q = i
assert e.v.q.z.q.txt == "i"