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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
f = C("f")
k = D("k")
a = E("a")
j = F("j")
h = F("h")

g.x = h
n.r = f
n.o = j
f.y = j
f.v = j
f.u = h
f.p = g
k.q = g
a.q = g
a.o = g
j.r = a
j.w = a
j.s = f
j.z = f
j.x = g
j.y = h
h.r = a
h.w = a
h.s = f
h.z = f
h.x = g
h.y = j
assert f.y.r.o.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
f = C("f")
k = D("k")
a = E("a")
j = F("j")
h = F("h")

g.x = h
n.r = f
n.o = j
f.y = j
f.v = j
f.u = h
f.p = g
k.q = g
a.q = g
a.o = g
j.r = a
j.w = a
j.s = f
j.z = f
j.x = g
j.y = h
h.r = a
h.w = a
h.s = f
h.z = f
h.x = g
h.y = j
assert f.y.r.o.x.z.txt == "f"