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

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

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

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

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

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

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

d.o = f
d.w = m
d.r = g
e.q = h
e.o = h
e.u = h
g.t = f
g.p = e
j.v = n
h.t = k
h.u = g
m.s = f
m.r = f
n.s = g
n.r = f
k.o = f
k.w = m
k.r = g
f.t = g
f.p = e
assert d.o.p.q.t.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: F = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

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

d.o = f
d.w = m
d.r = g
e.q = h
e.o = h
e.u = h
g.t = f
g.p = e
j.v = n
h.t = k
h.u = g
m.s = f
m.r = f
n.s = g
n.r = f
k.o = f
k.w = m
k.r = g
f.t = g
f.p = e
assert d.o.p.q.t.w.r.txt == "f"