class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: A = None
        self.s: E = None
        self.t: E = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.v: D = None
        self.o: D = None
        self.u: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.v: D = None
        self.o: D = None
        self.u: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

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

a.r = b
a.x = f
a.s = j
a.t = c
a.p = h
h.w = k
h.u = k
h.v = b
h.o = b
i.z = a
b.t = h
b.o = i
j.y = b
j.r = k
j.v = i
k.y = i
c.y = b
c.r = k
c.v = i
f.r = b
f.x = a
f.s = c
f.t = j
f.p = h
assert h.v.t.w.y.z.x.txt == "f"