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

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

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

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

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

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

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

d.s = g
d.w = g
d.r = c
d.p = c
d.y = b
m.z = g
b.u = d
g.v = m
g.s = d
g.r = d
g.x = b
k.v = f
c.t = m
f.v = k
assert d.r.t.z.x.u.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: F = None
        self.p: F = None
        self.w: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

d.s = g
d.w = g
d.r = c
d.p = c
d.y = b
m.z = g
b.u = d
g.v = m
g.s = d
g.r = d
g.x = b
k.v = f
c.t = m
f.v = k
assert d.r.t.z.x.u.w.x.txt == "b"