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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

f.u = k
e.v = k
e.r = f
e.z = f
e.t = h
h.s = j
c.t = h
b.v = k
b.x = h
m.y = h
m.u = f
k.t = h
d.v = c
d.x = h
j.v = c
j.r = f
j.z = f
j.t = h
assert d.x.s.r.u.t.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

f.u = k
e.v = k
e.r = f
e.z = f
e.t = h
h.s = j
c.t = h
b.v = k
b.x = h
m.y = h
m.u = f
k.t = h
d.v = c
d.x = h
j.v = c
j.r = f
j.z = f
j.t = h
assert d.x.s.r.u.t.s.z.txt == "f"