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

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

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

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

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

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

d = A("d")
g = B("g")
b = C("b")
k = D("k")
j = E("j")
l = F("l")

d.z = b
g.u = j
g.x = j
g.w = k
g.q = k
g.r = d
b.r = g
b.y = k
b.w = l
k.x = g
k.t = g
k.y = l
k.q = l
j.r = l
l.v = j
l.x = d
l.p = k
assert d.z.y.q.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

d = A("d")
g = B("g")
b = C("b")
k = D("k")
j = E("j")
l = F("l")

d.z = b
g.u = j
g.x = j
g.w = k
g.q = k
g.r = d
b.r = g
b.y = k
b.w = l
k.x = g
k.t = g
k.y = l
k.q = l
j.r = l
l.v = j
l.x = d
l.p = k
assert d.z.y.q.v.r.txt == "l"