class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.v: B = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.s: C = None
        self.x: B = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

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

f.y = d
d.u = i
m.y = f
m.p = d
m.v = d
m.w = i
m.x = i
j.w = c
c.x = h
e.q = d
e.x = d
e.o = h
e.s = b
e.u = b
e.p = c
h.u = i
b.y = i
b.x = i
b.p = h
b.v = d
b.w = f
i.y = d
n.w = c
assert b.w.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.v: B = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.s: C = None
        self.x: B = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

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

f.y = d
d.u = i
m.y = f
m.p = d
m.v = d
m.w = i
m.x = i
j.w = c
c.x = h
e.q = d
e.x = d
e.o = h
e.s = b
e.u = b
e.p = c
h.u = i
b.y = i
b.x = i
b.p = h
b.v = d
b.w = f
i.y = d
n.w = c
assert b.w.y.u.y.txt == "d"