class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.r: D = None
        self.u: B = None
        self.w: C = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: 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.z: A = None
        self.s: D = None
        self.y: A = None
        self.v: D = None
        self.txt = txt

d = A("d")
m = B("m")
c = C("c")
a = D("a")
h = E("h")
e = F("e")

d.y = m
d.v = m
d.u = m
d.r = a
d.w = c
d.t = c
m.v = d
m.w = a
m.r = a
c.s = a
c.w = e
a.u = e
h.r = e
e.z = d
e.y = d
e.s = a
e.v = a
assert c.w.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.r: D = None
        self.u: B = None
        self.w: C = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: 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.z: A = None
        self.s: D = None
        self.y: A = None
        self.v: D = None
        self.txt = txt

d = A("d")
m = B("m")
c = C("c")
a = D("a")
h = E("h")
e = F("e")

d.y = m
d.v = m
d.u = m
d.r = a
d.w = c
d.t = c
m.v = d
m.w = a
m.r = a
c.s = a
c.w = e
a.u = e
h.r = e
e.z = d
e.y = d
e.s = a
e.v = a
assert c.w.y.r.txt == "a"